/*
Copyright 2005-2014 CP Fricano - All Rights Reserved

This software and source code is licensed under the Apache
License, Version 2.0. You may not use this software or source
code except in compliance with the License.  You may obtain a
copy of the License at: http://www.apache.org/licenses/LICENSE-2.0.
Use and distributed under this License is on an "as is" basis,
without expressed or implied warranties or conditions of any kind.
See the License for the specific language governing permissions and
limitations.
 */

package com.fricano.java42.weather.api.provider.impl;

import java.net.ConnectException;
import java.util.Map;

import com.fricano.java42.base.components.datapointprovider.impl.ProviderConnector;
import com.fricano.java42.base.components.datapointprovider.impl.ProviderConnector_JSON;
import com.fricano.java42.base.components.datapointprovider.impl.ProviderDataPointMap;
import com.fricano.java42.base.components.datapointprovider.impl.ProviderFactory;
import com.fricano.java42.base.components.datapointprovider.impl.ProviderInfo;
import com.fricano.java42.base.components.utility.impl.Utility;
import com.fricano.java42.base.exception.ProgramCheck;
import com.fricano.java42.weather.api.provider.adapter.Key;
import com.fricano.java42.weather.api.provider.adapter.WeatherProviderInfo;

public class DarkSkyProviderInfo extends WeatherProviderInfo {

    public DarkSkyProviderInfo(final Object apiKey) {
        super(apiKey);
        super._query = "35.8776,-78.7875";
        super._dataPointMap.put(Key.TIME, new String[] { "currently", "time", });
        super._dataPointMap.put(Key.TEMPERATURE, new String[] { "currently", "temperature", });
        super._dataPointMap.put(Key.LOCATION_FULL, new String[] { "[flags]", });
        super._dataPointMap.put(Key.OBJECT.shared(0), new String[] { "hourly", "data", "[summary]", });
        super._dataPointMap.put(Key.OBJECT.shared(1), new String[] { "hourly", "data", "[time]", });
        super._dataPointMap.put(Key.OBJECT.shared(2), new String[] { "daily", "[data]", });
        super._dataPointMap.put(Key.OBJECT.shared(3), new String[] { "daily", "summary" });
        super._dataPointMap.put(Key.OBJECT.shared(4), new String[] { "daily", "icon" });
        super._dataPointMap.put(Key.OBJECT.shared(5), new String[] { "daily", "data" });
    }

    @Override
    public ProviderDataPointMap<Object, Object> getDataPointMap() {
        return super._dataPointMap;
    }

    @Override
    protected String getDebugBody() {
        final String debugBody = "{\"latitude\":35.8776,\"longitude\":-78.7875,\"timezone\":\"America/New_York\",\"offset\":-5,\"currently\":{\"time\":1391710790,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"nearestStormDistance\":5,\"nearestStormBearing\":166,\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":42.42,\"apparentTemperature\":42.42,\"dewPoint\":24.11,\"humidity\":0.5,\"windSpeed\":6.03,\"windBearing\":24,\"visibility\":10,\"cloudCover\":0.81,\"pressure\":1025.99,\"ozone\":285.84},\"minutely\":{\"summary\":\"Mostly cloudy for the hour.\",\"icon\":\"partly-cloudy-day\",\"data\":[{\"time\":1391710740,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391710800,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391710860,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391710920,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391710980,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711040,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711100,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711160,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711220,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711280,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711340,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711400,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711460,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711520,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711580,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711640,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711700,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711760,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711820,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711880,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391711940,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712000,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712060,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712120,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712180,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712240,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712300,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712360,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712420,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712480,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712540,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712600,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712660,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712720,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712780,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712840,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712900,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391712960,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713020,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713080,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713140,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713200,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713260,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713320,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713380,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713440,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713500,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713560,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713620,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713680,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713740,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713800,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713860,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713920,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391713980,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391714040,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391714100,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391714160,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391714220,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391714280,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1391714340,\"precipIntensity\":0,\"precipProbability\":0}]},\"hourly\":{\"summary\":\"Mostly cloudy later this afternoon.\",\"icon\":\"partly-cloudy-day\",\"data\":[{\"time\":1391709600,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":41.14,\"apparentTemperature\":36.93,\"dewPoint\":24.08,\"humidity\":0.5,\"windSpeed\":6.28,\"windBearing\":26,\"visibility\":10,\"cloudCover\":0.81,\"pressure\":1026.13,\"ozone\":285.93},{\"time\":1391713200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":42.24,\"apparentTemperature\":38.73,\"dewPoint\":24.17,\"humidity\":0.48,\"windSpeed\":5.53,\"windBearing\":22,\"visibility\":10,\"cloudCover\":0.83,\"pressure\":1025.72,\"ozone\":285.66},{\"time\":1391716800,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":42.37,\"apparentTemperature\":39.59,\"dewPoint\":23.86,\"humidity\":0.48,\"windSpeed\":4.56,\"windBearing\":24,\"visibility\":10,\"cloudCover\":0.84,\"pressure\":1025.26,\"ozone\":285.12},{\"time\":1391720400,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":42.39,\"apparentTemperature\":39.58,\"dewPoint\":24.42,\"humidity\":0.49,\"windSpeed\":4.6,\"windBearing\":23,\"visibility\":10,\"cloudCover\":0.98,\"pressure\":1024.99,\"ozone\":284.99},{\"time\":1391724000,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":42.16,\"apparentTemperature\":39.75,\"dewPoint\":25.47,\"humidity\":0.51,\"windSpeed\":4.08,\"windBearing\":27,\"visibility\":10,\"cloudCover\":0.99,\"pressure\":1025.08,\"ozone\":285.46},{\"time\":1391727600,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":40.38,\"apparentTemperature\":38.4,\"dewPoint\":25.78,\"humidity\":0.56,\"windSpeed\":3.36,\"windBearing\":31,\"visibility\":10,\"cloudCover\":1,\"pressure\":1025.36,\"ozone\":286.32},{\"time\":1391731200,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":39.18,\"apparentTemperature\":39.18,\"dewPoint\":26.94,\"humidity\":0.61,\"windSpeed\":2.31,\"windBearing\":32,\"visibility\":10,\"cloudCover\":1,\"pressure\":1025.68,\"ozone\":287.62},{\"time\":1391734800,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0004,\"precipProbability\":0.03,\"precipType\":\"rain\",\"temperature\":38.97,\"apparentTemperature\":38.97,\"dewPoint\":27.49,\"humidity\":0.63,\"windSpeed\":1.69,\"windBearing\":50,\"visibility\":10,\"cloudCover\":1,\"pressure\":1026.14,\"ozone\":289.39},{\"time\":1391738400,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0007,\"precipProbability\":0.06,\"precipType\":\"rain\",\"temperature\":38.58,\"apparentTemperature\":38.58,\"dewPoint\":27.75,\"humidity\":0.65,\"windSpeed\":1.72,\"windBearing\":69,\"visibility\":10,\"cloudCover\":1,\"pressure\":1026.59,\"ozone\":291.59},{\"time\":1391742000,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0008,\"precipProbability\":0.07,\"precipType\":\"rain\",\"temperature\":38.11,\"apparentTemperature\":38.11,\"dewPoint\":27.81,\"humidity\":0.66,\"windSpeed\":1.62,\"windBearing\":86,\"visibility\":10,\"cloudCover\":1,\"pressure\":1026.84,\"ozone\":294.15},{\"time\":1391745600,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0009,\"precipProbability\":0.08,\"precipType\":\"rain\",\"temperature\":37.48,\"apparentTemperature\":37.48,\"dewPoint\":28.29,\"humidity\":0.69,\"windSpeed\":2.31,\"windBearing\":110,\"visibility\":9.99,\"cloudCover\":0.95,\"pressure\":1026.8,\"ozone\":297.54},{\"time\":1391749200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.0008,\"precipProbability\":0.08,\"precipType\":\"rain\",\"temperature\":36.42,\"apparentTemperature\":34,\"dewPoint\":28.46,\"humidity\":0.73,\"windSpeed\":3.26,\"windBearing\":132,\"visibility\":9.98,\"cloudCover\":0.89,\"pressure\":1026.57,\"ozone\":301.29},{\"time\":1391752800,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.0007,\"precipProbability\":0.08,\"precipType\":\"rain\",\"temperature\":35.56,\"apparentTemperature\":32.62,\"dewPoint\":28.48,\"humidity\":0.75,\"windSpeed\":3.6,\"windBearing\":141,\"visibility\":9.97,\"cloudCover\":0.81,\"pressure\":1026.32,\"ozone\":304},{\"time\":1391756400,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.0004,\"precipProbability\":0.06,\"precipType\":\"snow\",\"temperature\":34.1,\"apparentTemperature\":34.1,\"dewPoint\":28.62,\"humidity\":0.8,\"windSpeed\":2.74,\"windBearing\":141,\"visibility\":9.03,\"cloudCover\":0.69,\"pressure\":1026.2,\"ozone\":304.92},{\"time\":1391760000,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.0002,\"precipProbability\":0.03,\"precipType\":\"snow\",\"temperature\":32.66,\"apparentTemperature\":32.66,\"dewPoint\":28.26,\"humidity\":0.84,\"windSpeed\":2.15,\"windBearing\":136,\"visibility\":9.17,\"cloudCover\":0.54,\"pressure\":1026.14,\"ozone\":304.79},{\"time\":1391763600,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":31.51,\"apparentTemperature\":31.51,\"dewPoint\":28.17,\"humidity\":0.87,\"windSpeed\":1.38,\"windBearing\":133,\"visibility\":9.29,\"cloudCover\":0.37,\"pressure\":1026.19,\"ozone\":304.45},{\"time\":1391767200,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":30.65,\"apparentTemperature\":30.65,\"dewPoint\":27.85,\"humidity\":0.89,\"windSpeed\":0.76,\"windBearing\":116,\"visibility\":9.18,\"cloudCover\":0.39,\"pressure\":1026.4,\"ozone\":304.15},{\"time\":1391770800,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":30.27,\"apparentTemperature\":30.27,\"dewPoint\":28.34,\"humidity\":0.92,\"windSpeed\":0.68,\"windBearing\":77,\"visibility\":9.43,\"cloudCover\":0.44,\"pressure\":1026.73,\"ozone\":303.63},{\"time\":1391774400,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":30.05,\"apparentTemperature\":30.05,\"dewPoint\":28.17,\"humidity\":0.93,\"windSpeed\":0.24,\"windBearing\":89,\"visibility\":9.73,\"cloudCover\":0.46,\"pressure\":1027.04,\"ozone\":303.02},{\"time\":1391778000,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":31.79,\"apparentTemperature\":31.79,\"dewPoint\":28.31,\"humidity\":0.87,\"windSpeed\":0.9,\"windBearing\":21,\"visibility\":9.86,\"cloudCover\":0.4,\"pressure\":1027.34,\"ozone\":302.31},{\"time\":1391781600,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":35.19,\"apparentTemperature\":35.19,\"dewPoint\":28.67,\"humidity\":0.77,\"windSpeed\":0.81,\"windBearing\":29,\"visibility\":9.68,\"cloudCover\":0.31,\"pressure\":1027.63,\"ozone\":301.5},{\"time\":1391785200,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":38.7,\"apparentTemperature\":38.7,\"dewPoint\":28.9,\"humidity\":0.68,\"windSpeed\":0.83,\"windBearing\":19,\"visibility\":9.76,\"cloudCover\":0.28,\"pressure\":1027.72,\"ozone\":300.68},{\"time\":1391788800,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":41.46,\"apparentTemperature\":41.46,\"dewPoint\":29.25,\"humidity\":0.62,\"windSpeed\":0.66,\"windBearing\":352,\"visibility\":10,\"cloudCover\":0.32,\"pressure\":1027.49,\"ozone\":299.74},{\"time\":1391792400,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":43.85,\"apparentTemperature\":43.85,\"dewPoint\":29.75,\"humidity\":0.57,\"windSpeed\":0.54,\"windBearing\":205,\"visibility\":10,\"cloudCover\":0.42,\"pressure\":1027.06,\"ozone\":298.78},{\"time\":1391796000,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":45.68,\"apparentTemperature\":45.68,\"dewPoint\":30.26,\"humidity\":0.55,\"windSpeed\":1.6,\"windBearing\":246,\"visibility\":10,\"cloudCover\":0.5,\"pressure\":1026.57,\"ozone\":298.17},{\"time\":1391799600,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":46.76,\"apparentTemperature\":46.76,\"dewPoint\":30.67,\"humidity\":0.53,\"windSpeed\":2.24,\"windBearing\":236,\"visibility\":10,\"cloudCover\":0.51,\"pressure\":1025.99,\"ozone\":298.32},{\"time\":1391803200,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":47.38,\"apparentTemperature\":47.38,\"dewPoint\":31.33,\"humidity\":0.53,\"windSpeed\":2.74,\"windBearing\":233,\"visibility\":10,\"cloudCover\":0.55,\"pressure\":1025.35,\"ozone\":298.82},{\"time\":1391806800,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":47.55,\"apparentTemperature\":47.55,\"dewPoint\":32.18,\"humidity\":0.55,\"windSpeed\":2.7,\"windBearing\":229,\"visibility\":10,\"cloudCover\":0.56,\"pressure\":1024.96,\"ozone\":298.84},{\"time\":1391810400,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":46.49,\"apparentTemperature\":46.49,\"dewPoint\":32.57,\"humidity\":0.58,\"windSpeed\":1.79,\"windBearing\":218,\"visibility\":10,\"cloudCover\":0.46,\"pressure\":1025.01,\"ozone\":298.05},{\"time\":1391814000,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":44.69,\"apparentTemperature\":44.69,\"dewPoint\":32.59,\"humidity\":0.62,\"windSpeed\":0.98,\"windBearing\":144,\"visibility\":10,\"cloudCover\":0.26,\"pressure\":1025.3,\"ozone\":296.78},{\"time\":1391817600,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":43.13,\"apparentTemperature\":43.13,\"dewPoint\":32.59,\"humidity\":0.66,\"windSpeed\":1.99,\"windBearing\":99,\"visibility\":10,\"cloudCover\":0.15,\"pressure\":1025.6,\"ozone\":295.25},{\"time\":1391821200,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":41.91,\"apparentTemperature\":41.91,\"dewPoint\":32.6,\"humidity\":0.69,\"windSpeed\":2.62,\"windBearing\":94,\"visibility\":10,\"cloudCover\":0.15,\"pressure\":1025.84,\"ozone\":293.27},{\"time\":1391824800,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":40.76,\"apparentTemperature\":40.76,\"dewPoint\":32.58,\"humidity\":0.72,\"windSpeed\":2.96,\"windBearing\":96,\"visibility\":10,\"cloudCover\":0.21,\"pressure\":1026.08,\"ozone\":291.04},{\"time\":1391828400,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":39.72,\"apparentTemperature\":37.88,\"dewPoint\":32.49,\"humidity\":0.75,\"windSpeed\":3.15,\"windBearing\":97,\"visibility\":10,\"cloudCover\":0.31,\"pressure\":1026.23,\"ozone\":289.27},{\"time\":1391832000,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":38.77,\"apparentTemperature\":36.74,\"dewPoint\":32.31,\"humidity\":0.77,\"windSpeed\":3.2,\"windBearing\":96,\"visibility\":10,\"cloudCover\":0.48,\"pressure\":1026.24,\"ozone\":288.18},{\"time\":1391835600,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":37.92,\"apparentTemperature\":35.89,\"dewPoint\":32.09,\"humidity\":0.79,\"windSpeed\":3.11,\"windBearing\":96,\"visibility\":10,\"cloudCover\":0.72,\"pressure\":1026.14,\"ozone\":287.55},{\"time\":1391839200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":37.26,\"apparentTemperature\":37.26,\"dewPoint\":31.92,\"humidity\":0.81,\"windSpeed\":2.94,\"windBearing\":95,\"visibility\":10,\"cloudCover\":0.9,\"pressure\":1025.93,\"ozone\":287.56},{\"time\":1391842800,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0001,\"precipProbability\":0.01,\"precipType\":\"rain\",\"temperature\":36.9,\"apparentTemperature\":36.9,\"dewPoint\":31.91,\"humidity\":0.82,\"windSpeed\":2.78,\"windBearing\":92,\"visibility\":10,\"cloudCover\":0.97,\"pressure\":1025.56,\"ozone\":288.21},{\"time\":1391846400,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0002,\"precipProbability\":0.02,\"precipType\":\"rain\",\"temperature\":36.74,\"apparentTemperature\":36.74,\"dewPoint\":31.98,\"humidity\":0.83,\"windSpeed\":2.65,\"windBearing\":86,\"visibility\":10,\"cloudCover\":0.99,\"pressure\":1025.08,\"ozone\":289.49},{\"time\":1391850000,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0003,\"precipProbability\":0.04,\"precipType\":\"rain\",\"temperature\":36.54,\"apparentTemperature\":36.54,\"dewPoint\":32.02,\"humidity\":0.83,\"windSpeed\":2.67,\"windBearing\":75,\"visibility\":10,\"cloudCover\":0.99,\"pressure\":1024.66,\"ozone\":291.46},{\"time\":1391853600,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0002,\"precipProbability\":0.03,\"precipType\":\"rain\",\"temperature\":35.93,\"apparentTemperature\":33.62,\"dewPoint\":31.85,\"humidity\":0.85,\"windSpeed\":3.11,\"windBearing\":59,\"visibility\":10,\"cloudCover\":1,\"pressure\":1024.32,\"ozone\":294.32},{\"time\":1391857200,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0002,\"precipProbability\":0.02,\"precipType\":\"rain\",\"temperature\":35.39,\"apparentTemperature\":32.17,\"dewPoint\":31.75,\"humidity\":0.86,\"windSpeed\":3.83,\"windBearing\":46,\"visibility\":10,\"cloudCover\":1,\"pressure\":1024.04,\"ozone\":297.88},{\"time\":1391860800,\"summary\":\"Overcast\",\"icon\":\"cloudy\",\"precipIntensity\":0.0014,\"precipProbability\":0.07,\"precipType\":\"rain\",\"temperature\":35.55,\"apparentTemperature\":31.84,\"dewPoint\":31.94,\"humidity\":0.87,\"windSpeed\":4.35,\"windBearing\":41,\"visibility\":10,\"cloudCover\":1,\"pressure\":1023.96,\"ozone\":301.64},{\"time\":1391864400,\"summary\":\"Drizzle\",\"icon\":\"rain\",\"precipIntensity\":0.0051,\"precipProbability\":0.27,\"precipType\":\"rain\",\"temperature\":36.84,\"apparentTemperature\":33.44,\"dewPoint\":32.4,\"humidity\":0.84,\"windSpeed\":4.24,\"windBearing\":46,\"visibility\":10,\"cloudCover\":1,\"pressure\":1024.32,\"ozone\":305.6},{\"time\":1391868000,\"summary\":\"Light Rain\",\"icon\":\"rain\",\"precipIntensity\":0.0102,\"precipProbability\":0.55,\"precipType\":\"rain\",\"temperature\":38.62,\"apparentTemperature\":35.71,\"dewPoint\":32.87,\"humidity\":0.8,\"windSpeed\":4.01,\"windBearing\":52,\"visibility\":10,\"cloudCover\":1,\"pressure\":1024.87,\"ozone\":309.77},{\"time\":1391871600,\"summary\":\"Light Rain\",\"icon\":\"rain\",\"precipIntensity\":0.0135,\"precipProbability\":0.72,\"precipType\":\"rain\",\"temperature\":40.08,\"apparentTemperature\":37.39,\"dewPoint\":33.47,\"humidity\":0.77,\"windSpeed\":4.02,\"windBearing\":57,\"visibility\":10,\"cloudCover\":1,\"pressure\":1024.93,\"ozone\":313.64},{\"time\":1391875200,\"summary\":\"Light Rain\",\"icon\":\"rain\",\"precipIntensity\":0.0134,\"precipProbability\":0.69,\"precipType\":\"rain\",\"temperature\":41.16,\"apparentTemperature\":38.19,\"dewPoint\":34.77,\"humidity\":0.78,\"windSpeed\":4.54,\"windBearing\":60,\"visibility\":10,\"cloudCover\":1,\"pressure\":1024.28,\"ozone\":317.46},{\"time\":1391878800,\"summary\":\"Light Rain\",\"icon\":\"rain\",\"precipIntensity\":0.0113,\"precipProbability\":0.54,\"precipType\":\"rain\",\"temperature\":42.19,\"apparentTemperature\":38.89,\"dewPoint\":36.5,\"humidity\":0.8,\"windSpeed\":5.23,\"windBearing\":63,\"visibility\":10,\"cloudCover\":1,\"pressure\":1023.12,\"ozone\":320.99},{\"time\":1391882400,\"summary\":\"Drizzle\",\"icon\":\"rain\",\"precipIntensity\":0.0091,\"precipProbability\":0.41,\"precipType\":\"rain\",\"temperature\":43.05,\"apparentTemperature\":39.65,\"dewPoint\":37.76,\"humidity\":0.81,\"windSpeed\":5.58,\"windBearing\":65,\"visibility\":10,\"cloudCover\":0.97,\"pressure\":1021.96,\"ozone\":322.97}]},\"daily\":{\"summary\":\"Mixed precipitation off-and-on throughout the week; temperatures peaking at 53° on Sunday.\",\"icon\":\"rain\",\"data\":[{\"time\":1391662800,\"summary\":\"Mostly cloudy throughout the day.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1391688761,\"sunsetTime\":1391726905,\"moonPhase\":0.24,\"precipIntensity\":0.0001,\"precipIntensityMax\":0.0009,\"precipIntensityMaxTime\":1391745600,\"precipProbability\":0.66,\"precipType\":\"rain\",\"temperatureMin\":32.47,\"temperatureMinTime\":1391688000,\"temperatureMax\":42.39,\"temperatureMaxTime\":1391720400,\"apparentTemperatureMin\":27.89,\"apparentTemperatureMinTime\":1391680800,\"apparentTemperatureMax\":39.58,\"apparentTemperatureMaxTime\":1391720400,\"dewPoint\":26.16,\"humidity\":0.62,\"windSpeed\":4.4,\"windBearing\":358,\"visibility\":10,\"cloudCover\":0.87,\"pressure\":1024.71,\"ozone\":284.61},{\"time\":1391749200,\"summary\":\"Partly cloudy throughout the day.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1391775107,\"sunsetTime\":1391813368,\"moonPhase\":0.28,\"precipIntensity\":0.0001,\"precipIntensityMax\":0.0008,\"precipIntensityMaxTime\":1391749200,\"precipProbability\":0.08,\"precipType\":\"rain\",\"temperatureMin\":30.05,\"temperatureMinTime\":1391774400,\"temperatureMax\":47.55,\"temperatureMaxTime\":1391806800,\"apparentTemperatureMin\":30.05,\"apparentTemperatureMinTime\":1391774400,\"apparentTemperatureMax\":47.55,\"apparentTemperatureMaxTime\":1391806800,\"dewPoint\":30.14,\"humidity\":0.72,\"windSpeed\":0.98,\"windBearing\":134,\"visibility\":9.79,\"cloudCover\":0.44,\"pressure\":1026.33,\"ozone\":299.14},{\"time\":1391835600,\"summary\":\"Light rain until afternoon.\",\"icon\":\"rain\",\"sunriseTime\":1391861451,\"sunsetTime\":1391899831,\"moonPhase\":0.31,\"precipIntensity\":0.0035,\"precipIntensityMax\":0.0135,\"precipIntensityMaxTime\":1391871600,\"precipProbability\":0.72,\"precipType\":\"rain\",\"temperatureMin\":35.39,\"temperatureMinTime\":1391857200,\"temperatureMax\":46.19,\"temperatureMaxTime\":1391893200,\"apparentTemperatureMin\":31.84,\"apparentTemperatureMinTime\":1391860800,\"apparentTemperatureMax\":44.64,\"apparentTemperatureMaxTime\":1391893200,\"dewPoint\":35.41,\"humidity\":0.84,\"windSpeed\":3.48,\"windBearing\":79,\"visibility\":10,\"cloudCover\":0.83,\"pressure\":1022.42,\"ozone\":310.16},{\"time\":1391922000,\"summary\":\"Mostly cloudy throughout the day.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1391947794,\"sunsetTime\":1391986293,\"moonPhase\":0.34,\"precipIntensity\":0.0002,\"precipIntensityMax\":0.0005,\"precipIntensityMaxTime\":1391997600,\"precipProbability\":0.01,\"precipType\":\"rain\",\"temperatureMin\":35.63,\"temperatureMinTime\":1391943600,\"temperatureMax\":52.67,\"temperatureMaxTime\":1391972400,\"apparentTemperatureMin\":30.82,\"apparentTemperatureMinTime\":1391943600,\"apparentTemperatureMax\":52.67,\"apparentTemperatureMaxTime\":1391972400,\"dewPoint\":36.43,\"humidity\":0.78,\"windSpeed\":5.7,\"windBearing\":250,\"visibility\":10,\"cloudCover\":0.64,\"pressure\":1016.96,\"ozone\":346.12},{\"time\":1392008400,\"summary\":\"Mostly cloudy throughout the day.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1392034135,\"sunsetTime\":1392072756,\"moonPhase\":0.38,\"precipIntensity\":0.0003,\"precipIntensityMax\":0.0009,\"precipIntensityMaxTime\":1392069600,\"precipProbability\":0.03,\"precipType\":\"rain\",\"temperatureMin\":28.3,\"temperatureMinTime\":1392033600,\"temperatureMax\":39.4,\"temperatureMaxTime\":1392058800,\"apparentTemperatureMin\":20.9,\"apparentTemperatureMinTime\":1392033600,\"apparentTemperatureMax\":35.75,\"apparentTemperatureMaxTime\":1392058800,\"dewPoint\":24.31,\"humidity\":0.67,\"windSpeed\":4.79,\"windBearing\":333,\"cloudCover\":0.71,\"pressure\":1023.09,\"ozone\":328.95},{\"time\":1392094800,\"summary\":\"Light rain throughout the day.\",\"icon\":\"rain\",\"sunriseTime\":1392120475,\"sunsetTime\":1392159217,\"moonPhase\":0.41,\"precipIntensity\":0.0082,\"precipIntensityMax\":0.0151,\"precipIntensityMaxTime\":1392159600,\"precipProbability\":0.53,\"precipType\":\"rain\",\"temperatureMin\":27.89,\"temperatureMinTime\":1392116400,\"temperatureMax\":41.6,\"temperatureMaxTime\":1392145200,\"apparentTemperatureMin\":20.82,\"apparentTemperatureMinTime\":1392120000,\"apparentTemperatureMax\":38.2,\"apparentTemperatureMaxTime\":1392145200,\"dewPoint\":24.37,\"humidity\":0.66,\"windSpeed\":4.84,\"windBearing\":49,\"cloudCover\":0.62,\"pressure\":1027.15,\"ozone\":339.12},{\"time\":1392181200,\"summary\":\"Sleet throughout the day.\",\"icon\":\"sleet\",\"sunriseTime\":1392206814,\"sunsetTime\":1392245679,\"moonPhase\":0.44,\"precipIntensity\":0.0265,\"precipIntensityMax\":0.0673,\"precipIntensityMaxTime\":1392242400,\"precipProbability\":0.91,\"precipType\":\"sleet\",\"temperatureMin\":30.95,\"temperatureMinTime\":1392206400,\"temperatureMax\":38.9,\"temperatureMaxTime\":1392264000,\"apparentTemperatureMin\":24.57,\"apparentTemperatureMinTime\":1392206400,\"apparentTemperatureMax\":34.09,\"apparentTemperatureMaxTime\":1392264000,\"dewPoint\":31.2,\"humidity\":0.85,\"windSpeed\":6.7,\"windBearing\":54,\"cloudCover\":0.99,\"pressure\":1023.14,\"ozone\":340.93},{\"time\":1392267600,\"summary\":\"Light rain until evening.\",\"icon\":\"rain\",\"sunriseTime\":1392293151,\"sunsetTime\":1392332140,\"moonPhase\":0.48,\"precipIntensity\":0.0139,\"precipIntensityMax\":0.0381,\"precipIntensityMaxTime\":1392271200,\"precipProbability\":0.91,\"precipType\":\"rain\",\"temperatureMin\":37.27,\"temperatureMinTime\":1392289200,\"temperatureMax\":46.5,\"temperatureMaxTime\":1392321600,\"apparentTemperatureMin\":31.82,\"apparentTemperatureMinTime\":1392289200,\"apparentTemperatureMax\":43.78,\"apparentTemperatureMaxTime\":1392321600,\"dewPoint\":39.65,\"humidity\":0.93,\"windSpeed\":5.05,\"windBearing\":326,\"cloudCover\":0.86,\"pressure\":1012.44,\"ozone\":365.71}]},\"flags\":{\"sources\":[\"nwspa\",\"isd\",\"fnmoc\",\"sref\",\"rap\",\"nam\",\"cmc\",\"gfs\",\"nearest-precip\",\"madis\",\"lamp\",\"darksky\"],\"isd-stations\":[\"723060-13722\",\"746939-93785\",\"746939-99999\",\"999999-03758\",\"999999-13784\"],\"madis-stations\":[\"AN406\",\"AP098\",\"AU697\",\"AU734\",\"KRDU\"],\"lamp-stations\":[\"KIGX\",\"KLHZ\",\"KRDU\",\"KTDF\",\"KTTA\"],\"darksky-stations\":[\"KRAX\"],\"units\":\"us\"}}";
        return debugBody;
    }

    @Override
    protected String getHostName() {
        return "api.forecast.io";
    }

    @Override
    protected int getPort() {
        return 443;
    }

    @Override
    protected String getProtocol() {
        return "https";
    }

    @Override
    protected String getProviderClassName() {
        return ProviderConnector_JSON.class.getName();
    }

    @Override
    public String getProviderName() {
        return "DarkSky";
    }

    @Override
    protected String getQuery() {
        final String apiKey = super.getApiKey();
        return "/forecast/" + apiKey + "/" + super._query;
    }

    @Override
    public Map<String, String> getRequestHeaders() {
        return null;
    }

    @Override
    public void setQuery(final String query) {
        super._query = query;
    }

    @Override
    protected Object translateDataPoint(final Object name, Object value) {
        if (name == null) {
            throw new ProgramCheck("");
        }
        if (name.equals(Key.TIME) && value instanceof Integer) {
            value = Utility.translateUnixTime((Integer) value);
        }
        return value;
    }

    @Override
    protected void translateFinal() {
    }

    @Override
    protected void translateQuery() {
        final ProviderInfo info = new GoogleGeoCodeProviderInfo("");
        info.setQuery(super._query);
        info.setOfflineMode(super.isOfflineMode());
        final ProviderConnector providerConnector = ProviderFactory.createProvider(info);
        Map<Object, Object> dataPointMap = null;
        try {
            dataPointMap = providerConnector.connect();
        } catch (final ConnectException e) {
            e.printStackTrace();
        }
        if (dataPointMap != null) {
            final Object latitude = dataPointMap.get(Key.LOCATION_LATITUDE);
            final Object longitude = dataPointMap.get(Key.LOCATION_LONGITUDE);
            super._query = latitude + "," + longitude;
        }
    }

}
